use strict;
use warnings;
use Test::More tests => 11;
use URI;
use File::Slurp;

use Carp 'confess';
$SIG{__DIE__} = \&confess;

BEGIN { use_ok 'Text::Microformat' }
use Data::Dumper;
$Data::Dumper::Terse = 1;
$Data::Dumper::Useqq = 1;
my $html = read_file('t/bluemirror.html');
my $uformat = Text::Microformat->new($html);
my @things = $uformat->find;
#print STDERR ref $things[0]->grantee->[0]->fn, "\n";
is($things[0]->Get('title'), 'The title of a Grant');
is($things[0]->Get('grantee.url'), 'http://www.2020vision.org');
is($things[0]->Get('grantee.fn'), '20/20 Vision Education Fund');
is($things[0]->Get('period.dtstart'), '2002-06-03T00:00:00Z');
is($things[0]->Get('period.dtend'), '2002-12-03');
is($things[0]->Get('description'), 'To publicize a new study of the employment impacts of raising fuel economy standards.');
is($things[0]->Get('grantor.url'), 'http://www.solpath.org?bluemirror');
is($things[0]->Get('grantor.fn'), 'The Blue Mirror Foundation');
is($things[0]->Get('amount.currency'), 'USD');
is($things[0]->Get('amount.amount'), '25000');
